package com.lg.partition13;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/4/22 15:35
 */
public class P1265公路修建 {

    private static final int N = 5010, INF = 0x3f3f3f3f;
    private static int[][] p = new int[N][2];
    private static double[] dist = new double[N];
    private static boolean[] st = new boolean[N];
    private static int n, m = 0;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        for (int i = 1; i <= n; i++) {
            p[i][0] = nextInt();
            p[i][1] = nextInt();
        }
        writer.format("%.2f", prim());
        writer.flush();
    }

    private static double prim() {
        Arrays.fill(dist, INF);
        dist[1] = 0;
        double res = 0;
        for (int k = 0; k < n; k++) {
            int u = -1;
            for (int i = 1; i <= n; i++) {
                if (!st[i] && (u == -1 || dist[u] > dist[i])) {
                    u = i;
                }
            }
            st[u] = true;
            res += dist[u];
            for (int v = 1; v <= n; v++) {
                double d = cal(u, v);
                dist[v] = Math.min(dist[v], d);
            }
        }
        return res;
    }

    private static double cal(int p1, int p2) {
        int x1 = p[p1][0], y1 = p[p1][1], x2 = p[p2][0], y2 = p[p2][1];
        int x = Math.abs(x1 - x2), y = Math.abs(y1 - y2);
        return Math.sqrt((long) x * x + (long) y * y);
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
